package com.pureut.system.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.pureut.common.security.utils.SecurityUtils;
import com.pureut.system.domain.InventoryPlan;
import com.pureut.system.domain.vo.InventoryPlanVo;
import com.pureut.system.mapper.InventoryPlanMapper;
import com.pureut.system.service.IInventoryPlanService;
import org.springframework.stereotype.Service;
import java.util.Date;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import javax.annotation.Resource;

/**
 * @Author: pureut
 * @Date: 2025-04-08 14:06:35
 * @Desc: 库存盘点方案表
 */
@Service("inventoryPlanService")
public class InventoryPlanServiceImpl extends ServiceImpl<InventoryPlanMapper, InventoryPlan> implements IInventoryPlanService {

    /**
     * 库存盘点方案表Dao
     */
    @Resource
    private InventoryPlanMapper inventoryPlanMapper;




    /**
     * 新增库存盘点方案表
     * @param inventoryPlanVo
     * @return
     */
    @Override
    public Boolean save(InventoryPlanVo inventoryPlanVo) {
        InventoryPlan inventoryPlan = new InventoryPlan();
        BeanUtil.copyProperties(inventoryPlanVo, inventoryPlan);
        inventoryPlan.setCreateBy(SecurityUtils.getUsername());
        inventoryPlan.setUpdateBy(SecurityUtils.getUsername());
        inventoryPlan.setCreateTime(new Date());
        return save(inventoryPlan);
    }


    /**
     * 更新库存盘点方案表
     * @param inventoryPlanVo
     * @return
     */
    @Override
    public Boolean updateById(InventoryPlanVo inventoryPlanVo) {
        InventoryPlan inventoryPlan = new InventoryPlan();
        BeanUtil.copyProperties(inventoryPlanVo, inventoryPlan);
        inventoryPlan.setUpdateBy(SecurityUtils.getUsername());
        inventoryPlan.setUpdateTime(new Date());
        return updateById(inventoryPlan);
    }
}
